<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>SGA Course Critique | <?php print $pageTitle; ?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
        <?php include('views/inc/assets.htmlf') ?>
<script>
$(document).ready(function() {
	var liveSearch =jQuery('#popup');
	if (!liveSearch.length) { 
		liveSearch=jQuery("<div id='popup'></div>")
			.appendTo(document.body)
			.position
	}
   $('#livesearch').click(function() {
   	if ($('#livesearch').attr('value')=="Enter a Course or Professor Name") {
   		$('#livesearch').attr('value',"");
   	}
   });
   $('#livesearch').blur(function() {
   	if ($('#livesearch').attr('value')=="") {
   		$('#livesearch').attr('value',"Enter a Course or Professor Name");
   	}
   });
   $('#CourseNumber').click(function() {
      	if ($('#CourseNumber').attr('value')=="Enter a Course Number") {
   		$('#CourseNumber').attr('value',"");
   	}
   });
   $('#livesearch').keyup(function(event) {
   	 if (event.keyCode==38) { //up arrow
   	 		if ($('#popup').find('.selected').prev().html() != '') { //if you're not at the top of the list, move the selection up
   	    		$('#popup').find('.selected').removeClass('selected').prev().addClass('selected');
   	    	}
   	 }
   	 else if (event.keyCode==40) { //down arrow.
   	 	 if ($('#popup').find('.selected').val()==null) {  //nothing selected at all, move to first.
   	 	 	$('#popup').find('.result').first().next().addClass('selected');
   	 	 }
   		 else if ($('#popup').find('.selected').next().html() != null) { //something is selected, remove selection and move to next unless at end.
   			$('#popup').find('.selected').removeClass('selected').next().addClass('selected');
   	 	 }
   	 }
   	 else if (event.keyCode==13) { //enter handler -- perform search.
   	 	if ($('#popup').find('.selected').val()!=null) {
	   	 	window.location="Search.php?generalSearch="+$('#popup').find('.selected').attr('term');
	   	 } 
   	 }
   	 else {
   	 	//fetch live search results
	     $.getJSON('liveSearch.php',{ generalSearch: $('#livesearch').val()}, 
	     	function(data) {
	     		$('#popup').empty();
				$('#popup').append('<div class="result"></div>');
				$.each(data, function(i, item) {
					if (item.ProfessorID != null) { 
						 $('#popup').append('<div class="result" term="'+item.LastName+', '+item.FirstName+'">'+item.LastName+', '+item.FirstName+' <small>Avg: '+item.GPA+'</small></div>');
					} else { 
						$('#popup').append('<div class="result" term="'+item.DepartmentCode+ ' ' + item.CourseNumber+'">'+item.DepartmentCode+' '+item.CourseNumber+' <small>Avg: '+item.GPA+'</small></div>');
					}
				});
				$('#popup .result').hover(function(event) {
					$(this).addClass('selected');
				 });
				 $('#popup .result').mouseleave(function(event) {
					$(this).removeClass('selected');
				 });
				 $('#popup .result').click(function(event) {
					window.location="Search.php?generalSearch="+$(this).attr('term');
				 });
			});
	}
   });
 });
 </script>

</head>

<body id="home">

    <div id="header">
        <div class="hiddenItem">
            <a href="#start" accesskey="2">Skip to content.</a>
            <a href="#navigation" accesskey="3">Skip to navigation.</a>
        </div>
        <div id="logoWrapper" class="clearfix">
            <h1 id="logo">
                <a href="/" accesskey="1">Georgia Institute of Technology</a>
            </h1>
                <h2 id='siteName'><a href='index.php'>Course Critique</a></h2>
        </div>

        <?php require_once('views/inc/utilityNav.htmlf') ?>
        
        <div id="breadcrumb">
            <ol>
            	<?php 
            		if (isset($breadcrumbs)) {
            		foreach($breadcrumbs as $breadcrumb) {
            			print "<li><a href='".$breadcrumb['URL']."'>".$breadcrumb['Title']."</a></li>";
					}
					}
					?>
            </ol>
        </div>
    </div>
    
    <div id="meat">
        <div id="support">
            <?php include('views/inc/mainNav.php') ?>
			<div id="didYouKnow" class="roundedCorners">
                <h4 class="title"><?php print $didYouKnow['Title']; ?> </h4>
                <p class="body"><?php print $didYouKnow['Content']; ?></p>
                <div class="footer"><p></p></div>   
            </div>
            
        </div>
        
        <div id="content">
			<?php print $content; ?>
            

      
        </div>
    </div>
<!--    <div id="footer">
	<p>&copy;2008 Georgia Tech Student Government Association :: Atlanta, Georgia 30332</p>
</div>-->
</body>

</html>
